Data is saved as excel file in XLSX format 
Syntax is for SAS v. 9.4 

*SAS syntax Hall Smith 2025;
*NOTE: import data set as 'OC' ;  

*** Observed confidence by semester for both groups (intervention vs null); 

proc sort data=OC; by sem assessB4Confidence; run;
*assessment score by group; 
	proc means data=OC noprint; 
output out = Means (Drop= _FREQ_ _TYPE_); 
VAR Confidence; 
BY sem AssessB4Confidence; 
run; 
*delete irrelevant output; 
Data Means (RENAME=(Confidence=Mean_Scores));SET Means; 
	IF _STAT_ = "MEAN"; 
	IF NOT MISSING (sem); 
	IF NOT MISSING (Confidence); 
	WHERE NOT MISSING (AssessB4Confidence);
	DROP _STAT_;
	LABEL Scores=;
	run;

	proc sort Data= OC; by sem; run; 
	data scoresplot; merge OC Means; By sem; run; 

	ODS GRAPHICS / NOBORDER; 
	PROC SGPLOT DATA=Scoresplot NOBORDER; 
	WHERE NOT MISSING (ASSESSB4CONFIDENCE);
	title1 "Confidence by Semester";
	XAXIS VALUES = (0 TO 11 BY 1) LABEL = "Semesters from Fall 2018" ;
	YAXIS VALUES = (0 TO 10 BY 1) LABEL = "Mean Confidence"; 
	SERIES X = sem Y=Mean_Scores / GROUP=AssessB4Confidence LINEATTRS=(  THICKNESS=3); 
	run; quit; 
	proc print data means; run; 



*** For Fig 4. Observed Average assessment score by semester for both groups (intervention vs null); 

proc sort data=OC; by sem assessB4Confidence; run;
*assessment score by group; 
	proc means data=OC noprint; 
output out = Means (Drop= _FREQ_ _TYPE_); 
VAR A_correct; 
BY sem AssessB4Confidence; 
run; 
*delete irrelevant output; 
Data Means (RENAME=(A_correct=Mean_Scores));SET Means; 
	IF _STAT_ = "MEAN"; 
	IF NOT MISSING (sem); 
	IF NOT MISSING (A_correct); 
	WHERE NOT MISSING (AssessB4Confidence);
	DROP _STAT_;
	LABEL Scores=;
	run;

	proc sort Data= OC; by sem; run; 
	data scoresplot; merge OC Means; By sem; run; 

	ODS GRAPHICS / NOBORDER; 
	PROC SGPLOT DATA=Scoresplot NOBORDER; 
	WHERE NOT MISSING (ASSESSB4CONFIDENCE);
	title1 "Assessment Scores by Semester";
	XAXIS VALUES = (0 TO 11 BY 1) LABEL = "Semesters from Fall 2018" ;
	YAXIS VALUES = (0 TO 45 BY 5) LABEL = "Mean Score"; 
	SERIES X = sem Y=Mean_Scores / GROUP=AssessB4Confidence LINEATTRS=(  THICKNESS=3); 
	run; quit; 

	proc print data=means; run;



/*AssessB4Confidence A_correct Confidence Year Fall*/

*************; 
******************;
***************; 
*REGRESSION DISCONTINUITY;
****************;
***********;
*********;	
* note - this is already in public data set; 			
DATA OC; set OC;
	if sem =1 then do; slope1820 = -4; slope2023 = 0; end;  *fall 18; 
	if sem =2 then do; slope1820 = -3; slope2023 = 0; end; 
	if sem =3 then do; slope1820 = -2; slope2023 = 0; end; 
	if sem =4 then do; slope1820 = -1; slope2023 = 0; end; 
	if sem =5 then do; slope1820 = 0; slope2023 = 0; end; 
	if sem =6 then do; slope1820 = 0; slope2023 = 1; end; 
	if sem =7 then do; slope1820 = 0; slope2023 = 2; end; 
	if sem =8 then do; slope1820 = 0; slope2023 = 3; end; 
	if sem =9 then do; slope1820 = 0; slope2023 = 4; end; 
	if sem =10 then do; slope1820 = 0; slope2023 = 5; end; 
	if sem =11 then do; slope1820 = 0; slope2023 = 6; end; 
	*separate intercepts; 
	int18 = 1; 
	if sem >=5 then int18 = 0; 

	int20 = 1; 
	if (sem <5) then int20 = 0; 

run; 

proc univariate data=OC; var confidence; run;

*Confidence regression discontinuity (overall); 
proc glimmix data=OC; 
model Confidence = int18 int20 slope1820 slope2023 / noint solution; 
estimate "18"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 "  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f" int18 0 int20 1 slope1820 0 slope2023 0,
		"21"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f"  int18 0 int20 1 slope1820 0 slope2023 6 /cl; 
estimate "18 vs 20" int18 1 int20 -1/ cl; 
estimate "slope1820" slope1820 1, 
		 "slope2023" slope2023 1 /cl; 
estimate "slope1820 vs slope2023" slope1820 1 slope2023 -1 / cl; 
run;

*FIGURE 1; 
*Confidence regression discontinuity (by pseudo manipulation group (whether assess before confidence); 
proc glimmix data=OC; 
model Confidence = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run; title; 









**********************;
*FIGURE 3 zscore overconfidence by group; 
*********************;


proc univariate data=OC; var ZA_correct; run;

proc glimmix data=OC; 
model Overconfidence = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;


***********************subanalysis -  citizenship only items; 
*Overconfidence_zCitizen; title;
proc glimmix data=OC; 
model Overconfidence_zcitizen = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;

***************************************************************; 





**********************;
*FIGURE 2 quintile overconfidence by group; 
*********************;
************* quintiles calculated for each semester; 

*model for overconfidence quintile by semester; 
proc glimmix data=OC; 
model Overconf_quint_sem = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;

***********************subanalysis -  citizenship only items; 
***** quintiles by semester for  subset of just citizen test items; 
*******************;

*model for  overconfidence (citizenship test subset) quintile by semester; 
proc glimmix data=OC; 
model CIT_Overconf_quint_sem = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;

***;
*Alternative overall with quintiles calculated overall; 
****;
proc glimmix data=OC; 
model Overconfidence_quint = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;




***FIGURE 4 OBJECTIVE KNOWLEDGE ; 

proc glimmix data=OC; 
model A_correct = int18 int20 slope1820 slope2023 int18*AssessB4Confidence int20*AssessB4Confidence slope1820*AssessB4Confidence slope2023*AssessB4Confidence/ noint solution; 
estimate "18 control"  int18 1 int20 0 slope1820 -4 slope2023 0,
		"19 control"   int18 1 int20 0 slope1820 -3 slope2023 0,
		"19 f control" int18 1 int20 0 slope1820 -2 slope2023 0,
		"20 control"  int18 0 int20 1 slope1820 -1 slope2023 0,
		"20 f control" int18 0 int20 1 slope1820 0 slope2023 0,
		"21 control"   int18 0 int20 1 slope1820 0 slope2023 1,
		"21f control"  int18 0 int20 1 slope1820 0 slope2023 2,
		"22 control"   int18 0 int20 1 slope1820 0 slope2023 3,
		"22f control"  int18 0 int20 1 slope1820 0 slope2023 4,
		"23 control"   int18 0 int20 1 slope1820 0 slope2023 5,
		"23f control"  int18 0 int20 1 slope1820 0 slope2023 6, 

		"18  "  int18 1 int20 0 slope1820 -4 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -4 slope2023*AssessB4Confidence 0,
		"19 "   int18 1 int20 0 slope1820 -3 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -3 slope2023*AssessB4Confidence 0,
		"19 f " int18 1 int20 0 slope1820 -2 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -2 slope2023*AssessB4Confidence 0,
		"20  "  int18 0 int20 1 slope1820 -1 slope2023 0 int18*AssessB4Confidence 1 int20*AssessB4Confidence 0 slope1820*AssessB4Confidence -1 slope2023*AssessB4Confidence 0,

		"20 f " int18 0 int20 1 slope1820 0 slope2023 0 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 0,
		"21 "   int18 0 int20 1 slope1820 0 slope2023 1 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 1,
		"21f "  int18 0 int20 1 slope1820 0 slope2023 2 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 2,
		"22 "   int18 0 int20 1 slope1820 0 slope2023 3 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 3,
		"22f "  int18 0 int20 1 slope1820 0 slope2023 4 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 4,
		"23 "   int18 0 int20 1 slope1820 0 slope2023 5 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 5,
		"23f "  int18 0 int20 1 slope1820 0 slope2023 6 int18*AssessB4Confidence 0 int20*AssessB4Confidence 1 slope1820*AssessB4Confidence 0 slope2023*AssessB4Confidence 6  /cl; 
estimate "18 vs 20 control" int18 1 slope1820 -1 int20 -1/ cl; 
estimate "18 vs 20 intervention" int18 1 slope1820 -1 int18*AssessB4Confidence 1 slope1820*AssessB4Confidence -1 int20 -1 int20*AssessB4Confidence -1/ cl;
estimate "slope 1820 control" slope1820 1,
		 "slope 1820 intervention" slope1820 1 slope1820*AssessB4Confidence 1, 
		 "slope 2023 control" slope2023 1,
		 "slope 2023 intervention" slope2023 1 slope2023*AssessB4Confidence 1 / cl; 
estimate "slope 1820 vs slope 2023 control" slope1820 1 slope2023 -1 / cl;
estimate "slope 1820 vs slope 2023 intervention" slope1820 1 slope1820*AssessB4Confidence 1 slope2023 -1 slope2023*AssessB4Confidence -1 /  cl;
run;


















